<template>
    <div>
        <div class="banner" @click="handleBannerClick">
            <img class="banner-img" :src="bannerImg" alt="">
            <div class="banner-info">
                <div class="banner-title">{{sightName}}</div>
                <div class="banner-number"><span class="iconfont banner-icon">&#xe6f5;</span>12</div>
            </div>
        </div>
        <common-fade>
            <common-gallery
                    :galleryImgs="galleryImgs"
                    @close="handleGalleryClose"
                    v-show="showGallery"
            ></common-gallery>
        </common-fade>
    </div>

</template>

<script>

    import CommonGallery from '@/common/gallery/Gallery.vue'
    import CommonFade from '@/common/fade/Fade.vue'

    export default {
        name: "Banner",
        props: {
            sightName: String,
            bannerImg: String,
            galleryImgs: Array,
        },
        components: {
            CommonGallery,
            CommonFade,
        },
        data (){
            return {
                showGallery: false,
            }
        },
        methods: {
            handleBannerClick(){
                this.showGallery = true;
            },
            handleGalleryClose(){
                this.showGallery = false;
            }
        }
    }
</script>

<style lang="stylus" scoped>
    .banner
        overflow hidden
        height 0
        padding-bottom 55%
        position relative
        .banner-img
            width 100%
    .banner-info
        line-height .6rem
        display flex
        position absolute
        right 0
        bottom 0
        left 0
        color #fff
        background-image linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,.6))
        .banner-title
            flex 1
            font-size .32rem
            padding 0 .2rem
        .banner-number
            margin-top .14rem
            padding 0 .4rem
            height .32rem
            line-height .32rem
            border-radius .2rem
            font-size .24rem
            background rgba(0,0,0,.8)
            .banner-icon
                font-size .24rem
</style>
